package com.gxa.controller;
import com.gxa.common.R;
import com.gxa.service.PurchaseReportService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@Api(value = "报表",tags = "报表数据接口API")
@RequestMapping("/PurchaseReport")
public class PurchaseReportController {
    R r=new R();
    @Autowired
    private PurchaseReportService purchaseReportService;
    @RequestMapping(value = "/queryPurchaseReport",method = RequestMethod.POST)
    @ApiOperation(value = "查询采购报表接口",notes = "查询采购报表",httpMethod = "post", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryPurchaseReport(@RequestBody @ApiParam(name = "map",value = "参数集合")Map map){
        return purchaseReportService.queryPurchaseReport(map);
    }

    @RequestMapping(value = "/SalesReport",method = RequestMethod.POST)
    @ApiOperation(value = "销售报表接口",notes = "销售报表",httpMethod = "post", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R querySalesReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){
        return purchaseReportService.querySalesReport(map);
    }

    @RequestMapping(value = "/queryCorrespondentunit",method = RequestMethod.POST)
    @ApiOperation(value = "往来单位欠款报表接口",notes = "往来单位欠款报表",httpMethod = "post", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryCorrespondentunit(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){
        return purchaseReportService.queryCorrespondentunit(map);
    }

    @RequestMapping(value = "/queryWarehouseReport",method = RequestMethod.POST)
    @ApiOperation(value = "商品库存、收发报表查询接口",notes = "销售利润报表",httpMethod = "POST", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryWarehouseReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){
        return purchaseReportService.queryWarehouseReport(map);
    }

    @RequestMapping(value = "/querySalesprofitReport",method = RequestMethod.POST)
    @ApiOperation(value = "销售利润报表查询接口",notes = "销售利润报表",httpMethod = "post", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R querySalesprofitReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map  map){
       return purchaseReportService.querySalesprofitReport(map);
    }

    @RequestMapping(value = "/queryRmbReport",method = RequestMethod.POST)
    @ApiOperation(value = "现金银行报表查询接口",notes = "现金报表",httpMethod = "get", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryRmbReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){

      return purchaseReportService.queryRmbReport(map);
    }

    @RequestMapping(value = "/queryAccountsReport",method = RequestMethod.POST)
    @ApiOperation(value = "账款报表查询接口",notes = "账款报表",httpMethod = "get", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryAccountsReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){

        return purchaseReportService.queryAccountsReport(map);
    }

    @RequestMapping(value = "/queryAccountStatementReport",method = RequestMethod.POST)
    @ApiOperation(value = "对账单报表查询接口",notes = "对账单报表",httpMethod = "get", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryAccountStatementReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map  map){
        r.setCode(200);
        r.setMsg("success");
        return purchaseReportService.queryAccountStatementReport(map);
    }

    @RequestMapping(value = "/queryOtherincomeandexpenditureReport",method = RequestMethod.POST)
    @ApiOperation(value = "其他收支报表查询接口",notes = "其他收支",httpMethod = "get", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryOtherincomeandexpenditureReport(@RequestBody @ApiParam(name = "map",value = "参数集合") Map map){

        return purchaseReportService.queryOtherincomeandexpenditureReport(map);
    }
    @RequestMapping(value = "/queryAllReport",method = RequestMethod.POST)
    @ApiOperation(value = "首页模块数据显示接口",notes = "数据显示",httpMethod = "get", response = String.class)
    @ApiResponses({
            @ApiResponse(code=200,message="请求成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R queryAllReport(){

        return purchaseReportService.queryAllReport();
    }

}
